// const mysql = require("mysql");

// let pools = mysql.createPool({
//     host: "192.168.174.166",
//     user: "root",
//     password: "ddd",
//     database: "mydb"
// })

// function excute(sqlString, condition) {
//     let promise = new Promise((resolve, reject) => {
//         pools.query(sqlString, condition, function (error, result, fields) {
//             if (error) {
//                 reject(error);
//             }
//             else {
//                 resolve(result);
//             }
//         })
//     })
//     return promise;

// }

// module.exports = {
//     EXCUTE: excute
// }


const mysql = require("mysql");

let pools = mysql.createPool({
    host: "localhost",
    user: "root",
    password: "root",
    database: "mysql"
})

function excute(sqlString, condition) {
    let promise = new Promise((resolve, reject) => {
        pools.query(sqlString, condition, function (error, result, fields) {
            if (error) {
                reject(error);
            }
            else {
                resolve(result);
            }
        })
    })
    return promise;

}

module.exports = {
    EXCUTE: excute
}






